package net.sunofbeach.blog.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * Security 配置类
 * @author bing_  @create 2021/11/26-10:10
 * 用户角色一张表
 * @EnableGlobalMethodSecurity(prePostEnabled = true) 开启基于方法的安全认证机制，也就是说在web层的controller启用注解机制的安全确认，
 */
@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
public class  WebSpringSecurityConfig extends WebSecurityConfigurerAdapter  {

        @Override
        protected void configure(HttpSecurity http) throws Exception{
            // 所有都放行
            http.authorizeRequests()
                    .antMatchers("/**").permitAll()
                    .and().csrf().disable();
        }
}




























